const express = require("express");
const router = express.Router();
const userinfo_handler = require("../router_handler/userinfo");

const userHandler = require("../router_handler/user");

// 1. 导入验证表单数据的中间件
const expressJoi = require("@escook/express-joi");
// 2. 导入需要的验证规则对象
const {
  update_userinfo_schema,
  update_password_schema,
} = require("../schema/user");

router.get("/userinfo", userinfo_handler.getUserInfo);
router.post(
  "/userinfo",
  expressJoi(update_userinfo_schema),
  userinfo_handler.updateUserInfo
);
router.post(
  "/updatepwd",
  expressJoi(update_password_schema),
  userinfo_handler.updatePassword
);
router.post('/update/avatar', userinfo_handler.updateAvatar)

module.exports = router;
